
clear
use ReplicationData.dta


*Table 2*

eststo clear
xtset id year
eststo: reg milexpergdp L1.threat_shared_contig sharedadversary_notland L1.breakout_nopak_postcw L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg_41  growth lag_democracy L.colonial lag_rivalry_nonus_expansive  i.region3 if year > 1949 & sample_full==1 & us_ally==1, vce(cluster id)
estadd local regionfe "\checkmark" , replace
estadd local yearfe "" , replace
eststo: reg milexpergdp L1.threat_shared_contig L1.threat_shared_sea sharedadversary_noncontig L1.breakout_nopak_postcw L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg_41  growth lag_democracy L.colonial lag_rivalry_nonus_expansive  i.region3 if year > 1949 & sample_full==1 & us_ally==1, vce(cluster id)
estadd local regionfe "\checkmark" , replace
estadd local yearfe "" , replace
eststo: reg milexpergdp L1.threat_shared_contig L1.threat_shared_sea L1.breakout_nopak_postcw L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg_41  growth lag_democracy L.colonial lag_rivalry_nonus_expansive  sharedadversaryMID_movingavg4_41 L1.sharedadversary_cinc4 i.region3 if year > 1949 & sample_full==1 & us_ally==1 & sharedadversary==1, vce(cluster id)
estadd local regionfe "\checkmark" , replace
estadd local yearfe "" , replace
eststo: reg milexpergdp L1.sharedadversary_dist L1.breakout_nopak_postcw L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg_41  growth lag_democracy L.colonial lag_rivalry_nonus_expansive  sharedadversaryMID_movingavg4_41 L1.sharedadversary_cinc4 i.region3 if year > 1949 & sample_full==1 & us_ally==1 & sharedadversary==1 & threat_shared_contig==0, vce(cluster id)
estadd local regionfe "\checkmark" , replace
estadd local yearfe "" , replace
eststo: reg milexpergdp L1.threat_shared_contig sharedadversary_notland L1.breakout_nopak_postcw L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg_41  growth lag_democracy L.colonial lag_rivalry_nonus_expansive  i.region3 i.year if year > 1949 & sample_full==1 & us_ally==1, vce(cluster id)
estadd local regionfe "\checkmark" , replace
estadd local yearfe "\checkmark" , replace
eststo: reg milexpergdp L1.threat_shared_contig sharedadversary_notland L1.breakout_nopak_postcw L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg_41  growth lag_democracy L.colonial lag_rivalry_nonus_expansive L1.distance_us_min L1.gdppc_gleditsch  i.region3 if year > 1949 & sample_full==1 & us_ally==1, vce(cluster id)
estadd local regionfe "\checkmark" , replace
estadd local yearfe "" , replace
eststo clear

*Table 3*

eststo clear
eststo: reg milexpergdp L1.threat_shared_contig sharedadversary_notland L1.breakout_nopak_postcw L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg  growth lag_democracy L.colonial lag_rivalry_nonus_expansive  i.region3 if year > 1949 & sample_full==1 & us_ally==1, vce(cluster id)
margins, at(L1.threat_shared_contig=1 sharedadversary_notland=0 L1.breakout_nopak_postcw=1) atmeans vsquish
margins, at(L1.threat_shared_contig=1 sharedadversary_notland=0 L1.breakout_nopak_postcw=0) atmeans vsquish
margins, at(L1.threat_shared_contig=0 sharedadversary_notland=1 L1.breakout_nopak_postcw=1) atmeans vsquish
margins, at(L1.threat_shared_contig=0 sharedadversary_notland=1 L1.breakout_nopak_postcw=0) atmeans vsquish
margins, at(L1.threat_shared_contig=0 sharedadversary_notland=0 L1.breakout_nopak_postcw=1) atmeans vsquish
margins, at(L1.threat_shared_contig=0 sharedadversary_notland=0 L1.breakout_nopak_postcw=0) atmeans vsquish
eststo clear



*Figure 2*

bys year: egen europe_milexpergdp = mean(milexpergdp) if region3==2 & sample_full==1 & us_ally==1 & country != "Germany"

twoway (line milexpergdp year if country=="Germany" & year > 1960 & year < 1976) (line europe_milexpergdp year if country=="France" & year > 1960 & year < 1976, lpattern(dash)),  graphregion(fcolor(white)) xtitle("Year") ytitle("Military Spending (% of GDP)") legend(label(1 "Germany") label(2 "Rest of European NATO"))

*Figure 3*

twoway line milexpergdp year if country=="Japan" & year > 1960 & year < 1976,  graphregion(fcolor(white)) xtitle("Year") ytitle("Military Spending (% of GDP)")



*Table A2*
sutex milexpergdp threat_shared_contig sharedadversary_notland threat_shared_sea sharedadversary_noncontig breakout_nopak_postcw borderallies_region gdp_gleditsch troops MID_movingavg_41  growth lag_democracy colonial lag_rivalry_nonus_expansive  if year > 1949 & sample_full==1 & us_ally==1, labels minmax nobs

*Table A3*
pwcorr milexpergdp threat_shared_contig sharedadversary_notland threat_shared_sea sharedadversary_noncontig breakout_nopak_postcw borderallies_region if sample_full==1 & us_ally==1



*Table A4*

eststo clear
xtset id year
eststo: reg milexpergdp L1.threat_shared_contig sharedadversary_notland L1.breakout_nochina L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg_41  growth lag_democracy L.colonial lag_rivalry_nonus_expansive i.region3 if year > 1949 & sample_full==1 & us_ally==1, vce(cluster id)
estadd local regionfe "\checkmark" , replace
eststo: reg milexpergdp L1.threat_shared_contig sharedadversary_notland L1.breakout_nopostcw L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg_41  growth lag_democracy L.colonial lag_rivalry_nonus_expansive i.region3 if year > 1949 & sample_full==1 & us_ally==1, vce(cluster id)
estadd local regionfe "\checkmark" , replace
eststo: reg milexpergdp L1.threat_shared_contig_alt sharedadversary_notland L1.breakout_nopak_postcw L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg_41  growth lag_democracy L.colonial lag_rivalry_nonus_expansive  i.region3 if year > 1949 & sample_full==1 & us_ally==1, vce(cluster id)
estadd local regionfe "\checkmark" , replace
eststo: reg milexpergdp L1.threat_shared_contig sharedadversary_notland L1.breakout_pak_postcw L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg_41  growth lag_democracy L.colonial lag_rivalry_nonus_expansive i.region3 if year > 1949 & sample_full==1 & us_ally==1, vce(cluster id)
estadd local regionfe "\checkmark" , replace
eststo: reg milexpergdp L1.threat_shared_contig_broad sharedadversary_notland L1.breakout_nopak_postcw L1.borderallies_region L1.gdp_gleditsch L1.troops MID_movingavg_41  growth lag_democracy L.colonial lag_rivalry_nonus_expansive i.region3 if year > 1949 & sample_full==1 & us_ally==1, vce(cluster id)
estadd local regionfe "\checkmark" , replace
eststo clear

*Table A5*

eststo clear
xtset id year
eststo: reg hns_pctgdp3 L1.threat_shared_contig sharedadversary_notland if year > 1994 & year < 2003 & sample_full==1 & us_ally==1, cluster(id)
estadd local regionfe "" , replace
eststo: reg hns_pctgdp3 L1.threat_shared_contig sharedadversary_notland i.region3 L1.troops if year > 1994 & year < 2003 & sample_full==1 & us_ally==1, cluster(id)
estadd local regionfe "\checkmark" , replace
eststo: reg hns_pctgdp3 L1.threat_shared_contig sharedadversary_notland if year > 1994 & year < 2003 & sample_full==1 & us_ally==1 & avg_troops_1995_2002 > 99, cluster(id)
estadd local regionfe "" , replace
eststo: reg hns_pctgdp3 L1.threat_shared_contig sharedadversary_notland i.region3 L1.troops if year > 1994 & year < 2003 & sample_full==1 & us_ally==1 & avg_troops_1995_2002 > 99, cluster(id)
estadd local regionfe "\checkmark" , replace
eststo: reg hns_pctgdp3 L1.threat_shared_contig sharedadversary_notland if year > 1994 & year < 2003 & sample_full==1 & us_ally==1 & avg_troops_1995_2002 > 999, cluster(id)
estadd local regionfe "" , replace
eststo: reg hns_pctgdp3 L1.threat_shared_contig sharedadversary_notland L1.troops if year > 1994 & year < 2003 & sample_full==1 & us_ally==1 & avg_troops_1995_2002 > 999, cluster(id)
estadd local regionfe "" , replace
eststo clear

*Table A6*

eststo clear
eststo: reg log_hns3_resid L1.threat_shared_contig sharedadversary_notland if year > 1994 & year < 2003 & sample_full==1 & us_ally==1, cluster(id)
estadd local regionfe "" , replace
eststo: reg log_hns3_resid L1.threat_shared_contig sharedadversary_notland i.region3 if year > 1994 & year < 2003 & sample_full==1 & us_ally==1, cluster(id)
estadd local regionfe "\checkmark" , replace
eststo: reg log_hns3_resid L1.threat_shared_contig sharedadversary_notland if year > 1994 & year < 2003 & sample_full==1 & us_ally==1 & avg_troops_1995_2002 > 99, cluster(id)
estadd local regionfe "" , replace
eststo: reg log_hns3_resid L1.threat_shared_contig sharedadversary_notland i.region3 if year > 1994 & year < 2003 & sample_full==1 & us_ally==1 & avg_troops_1995_2002 > 99, cluster(id)
estadd local regionfe "" , replace
eststo: reg log_hns3_resid L1.threat_shared_contig sharedadversary_notland if year > 1994 & year < 2003 & sample_full==1 & us_ally==1 & avg_troops_1995_2002 > 999, cluster(id)
estadd local regionfe "" , replace
eststo clear


*Figure A1*  
bys year: egen yearly_milexpergdp = mean(milexpergdp) if sample_full==1 & us_ally==1
label var yearly_milexpergdp "Military Spending (% of GDP)"
graph twoway (scatter yearly_milexpergdp year, connect(l) clpattern(dash)), scheme(s2mono) graphregion(fcolor(white)) xtitle("Year") title("Average Allied Milex/GDP")



*Figure A2*

twoway (scatter hns_pctgdp3 troops if year > 1994 & year < 2003 & sample_full==1 & us_ally==1 & country != "Korea, Rep." & country != "Japan", mcolor(black)) (scatter hns_pctgdp3 troops if year > 1994 & year < 2003 & country == "Korea, Rep.", mcolor(red)) (scatter hns_pctgdp3 troops if year > 1994 & year < 2003 & country == "Japan", mcolor(blue)) (scatter hns_pctgdp3 troops if year > 1994 & year < 2003 & country == "Luxembourg", mcolor(pink)), graphregion(fcolor(white)) legend(order( 2 "South Korea" 3 "Japan" 4 "Luxembourg"))

twoway (scatter hns_pctgdp3 troops if year > 1994 & year < 2003 & sample_full==1 & us_ally==1 & country != "Korea, Rep." & country != "Japan" & country != "Luxembourg", mcolor(black)) (lfit hns_pctgdp3 troops if year > 1994 & year < 2003 & sample_full==1 & us_ally==1 & country != "Korea, Rep." & country != "Japan" & country != "Luxembourg"),  graphregion(fcolor(white)) ytick(0(0.1)0.3) ylabel(0(0.1)0.3)
